<?php
include("../../product/model.php");
include("../../image/model.php");

$body_html = "";

if (validate_image($_FILES['image']) == false)
{
	return;
}

$image = upload_image($_FILES['image'], "../../upload/");
if ($image == NULL)
{
	$body_html = "上传图片失败!";
	include("../template/layout.php");
	return;
}

$_POST["big_image"] = $image["big_image"];
$_POST["small_image"] = $image["small_image"];
if (model_insert_product($_POST) == true)
{
	// todo 自动跳转
	$body_html = "产品发布成功！";
}
else
{
	$body_html = "产品发布失败！";
}

include("../template/layout.php");
?>
